// custom-tab-bar/index.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {

    },

    /**
     * 组件的初始数据
     */
    data: {
        current:0,//当前选中的下标
        "list": [
            {
              "pagePath": "/pages/home/home",
              "iconPath": "/static/icons/home.png",
              "selectedIconPath": "/static/icons/home-active.png"
            },
            {
              "pagePath": "/pages/movie/movie",
              "iconPath": "/static/icons/movie.png",
              "selectedIconPath": "/static/icons/movie-active.png"
            },
            {
              "pagePath": "/pages/ticket/ticket",
              "iconPath": "/static/icons/ticket-active.png",
              "selectedIconPath": "/static/icons/ticket-active.png"
            },
            {
              "pagePath": "/pages/cinema/cinema",
              "iconPath": "/static/icons/cinema.png",
              "selectedIconPath": "/static/icons/cinema-active.png"
            },
            {
              "pagePath": "/pages/main/main",
              "iconPath": "/static/icons/main.png",
              "selectedIconPath": "/static/icons/main-active.png"
            }
      
          ]
    },

    /**
     * 组件的方法列表
     */
    methods: {
        doSwitchPage(e){
            // console.log(e);
            let index = e.currentTarget.dataset.index

            // 注意 虽然自定义tabbar 
            // 跳转页面还必须使用 wx.switchTab
            wx.switchTab({
              url: this.data.list[index].pagePath,
            })

            // this.setData({
            //     current:index
            // })
        }
    }
})
